attach(cystfibr)

lm03 <- lm(pemax ~ height + I(height^2))

summary(lm03)

pred_frame <- data.frame(height = seq(110, 180, 2))
lm_pemax_hq <- lm(pemax ~ height + I(height^2))

pp <- predict(lm_pemax_hq, newdata = pred_frame, interval = "pred")
pc <- predict(lm_pemax_hq, newdata = pred_frame, interval = "conf")

plot(height, pemax, ylim = c(0, 200))
matlines(pred_frame$height, pp, lty = c(1, 2, 2), col = "red")
matlines(pred_frame$height, pc, lty = c(1, 2, 3), col = "blue")
